// ==UserScript==
// @name         CSDN HELPER
// @namespace    http://tampermonkey.net/
// @version      2025-05-23
// @description  1. ADs remove 2. dark mode
// @author       https://github.com/18202409203
// @match        https://blog.csdn.net/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant        none
// ==/UserScript==

(function () {
  const darkMode = localStorage.getItem("darkMode");
  if (darkMode === "true") {
    document.body.dataset.theme = "dark";
  } else {
    document.body.dataset.theme = "light";
  }

  const style = document.createElement("style");
  style.type = "text/css";
  const text = document.createTextNode(/* css */ `
    .recommend-item-box,
    .recommend-right,
    #dmp_ad_58,
    aside,
    #container,
    .box-box-large,
    .meau-gotop-box {
      display: none !important;
    }
    main {
      width: 100% !important;
    }

    body[data-theme="dark"] {
      filter: invert(0.8);
    }`);
  style.appendChild(text);
  const head = document.getElementsByTagName("head")[0];
  head.appendChild(style);
})();
